<%@ page contentType="text/html;charset=ISO-8859-1" language="java" %>
<%@ page import="java.util.List" %>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
<%@ page import="com.google.gson.Gson" %>
<%@ page import="com.google.gson.GsonBuilder" %>
<%@ page import="com.eventosgasteiz.server.bbdd.Event" %>
<%@ page import="com.eventosgasteiz.server.bbdd.PMF" %>

<html>
  <body>
<%
    PersistenceManager pm = PMF.get().getPersistenceManager();
    String query = "select from " + Event.class.getName();
    List<Event> eventos = (List<Event>) pm.newQuery(query).execute();
    if (eventos.isEmpty()) {
%>
<p>No hay eventos.</p>
<%
    } else {
    	Gson gson = new GsonBuilder().disableHtmlEscaping().create();
        for (Event e : eventos) {
%>
<p><%= gson.toJson(e) %></p>
<%
        }
    }
    pm.close();
%>
  </body>
</html>